import request from '../../request/request.js'

Page({

  /**
   * 页面的初始数据
   */
  data: {
    keywords:'',
    coachList:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getCoachList();
  },
  getCoachList(param){
    request({
      url:'coach/list',
      method:'post',
      data:{name:param}
    }).then(res=>{
      this.setData({
        coachList:res.data.data.slice(0,4)
      })
    }).catch(err=>{})
  },
  onSearch(){
    this.getCoachList(this.data.keywords);
  },
  onChange(e){
    this.setData({keywords:e.detail})
  }
})